const {
	Service
} = require("uni-cloud-router");

module.exports = class AppletService extends(
	Service
) {
	async getAppletInfoById(appId) {
		let appletInfoData = await this.db.collection('wmz-applet-info').doc(appId).get()
		appletInfoData = appletInfoData.data[0]
		return appletInfoData
	}
	async getAppletInfoByTemplateId(templateId) {
		let appletInfoData = await this.db.collection('wmz-applet-info').where({
			'alipay.auth_app_id': templateId
		}).get()
		appletInfoData = appletInfoData.data[0]
		return appletInfoData
	}
	async getAppletInfoByWechatId(wechatId) {
		let appletInfoData = await this.db.collection('wmz-applet-info').where({
			'wechat.auth_app_id': wechatId
		}).get()
		appletInfoData = appletInfoData.data[0]
		return appletInfoData
	}
};